package com.tanhua.db.api;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tanhua.api.SoulQuestionOptionApi;
import com.tanhua.db.mapper.SoulOptionsMapper;
import com.tanhua.model.soul.SoulOptions;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class SoulQuestionOptionApiImpl implements SoulQuestionOptionApi {


    @Autowired
    private SoulOptionsMapper soulOptionsMapper;


    @Override
    public List<SoulOptions> getAllOptionByQuestionId(Integer questionId) {
        LambdaQueryWrapper<SoulOptions> wrapper = new LambdaQueryWrapper();
        wrapper.eq(SoulOptions::getQuestionId,questionId);

        return soulOptionsMapper.selectList(wrapper);
    }

    @Override
    public SoulOptions getById(String optionId) {
        return soulOptionsMapper.selectById(Integer.valueOf(optionId));
    }
}
